Action hook 'wp_ajax_nopriv_{$action}'

in WP Core File wp-admin/admin-ajax.php at line 207

View Source

wp_ajax_nopriv_{$action}

Action Hook
Description
Fires non-authenticated Ajax actions for logged-out users. The dynamic portion of the hook name, `$action`, refers to the name of the Ajax action callback being fired.

Hook Information

File Location wp-admin/admin-ajax.php View on GitHub
Hook Type Action
Line Number 207

Hook Parameters

This hook doesn't accept any parameters.

Usage Examples

Basic Usage
<?php
// Hook into wp_ajax_nopriv_{$action}
add_action('wp_ajax_nopriv_{$action}', 'my_custom_function');

function my_custom_function() {
    // Your custom code here
}

Source Code Context

wp-admin/admin-ajax.php:207 - How this hook is used in WordPress core
<?php
 202  	 * The dynamic portion of the hook name, `$action`, refers
 203  	 * to the name of the Ajax action callback being fired.
 204  	 *
 205  	 * @since 2.8.0
 206  	 */
 207  	do_action( "wp_ajax_nopriv_{$action}" );
 208  }
 209  
 210  // Default status.
 211  wp_die( '0' );

PHP Documentation

<?php
/**
	 * Fires non-authenticated Ajax actions for logged-out users.
	 *
	 * The dynamic portion of the hook name, `$action`, refers
	 * to the name of the Ajax action callback being fired.
	 *
	 * @since 2.8.0
	 */
Quick Info
  • Hook Type: Action
  • Parameters: 0
  • File: wp-admin/admin-ajax.php
Related Hooks

Related hooks will be displayed here in future updates.